<script setup name="login">
import { ref } from 'vue';
import { useStore } from 'vuex';

const store = useStore();

const params = ref({
  account: 'xiaotuxian001',
  password: '123456',
});

async function onLogin() {
  const res = await store.dispatch('user/login', params.value);
  if (!res.success) {
    console.log(res.msg);
  }
}
</script>

<template>
  <div class="container">
    <div class="form-wrapper">
      <el-form :model="params">
        <el-form-item>
          <el-input
            v-model="params.account"
          >
            <template #prepend>
              <i-ep-user class="icon" />
            </template>
          </el-input>
        </el-form-item>
        <el-form-item>
          <el-input
            v-model="params.password"
            type="password"
          >
            <template #prepend>
              <i-ep-lock class="icon" />
            </template>
          </el-input>
        </el-form-item>
      </el-form>
    </div>
    <el-button type="primary">按钮</el-button>
  </div>
</template>

<style lang="scss" scoped>
.container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;

  .form-wrapper {
    width: 380px;
    outline: 1px solid red;

    :deep(.el-input-group__prepend) {
      background-color: #cfcdcd;
      padding: 8px;
    }

    .icon {
      font-size: 18px;
      color: white;
    }
  }
}
</style>
